package LC13;

import java.util.HashMap;
import java.util.HashSet;

/**
 * 1207. 独一无二的出现次数
 *
 * @author zhangsan
 */
public class LC1207 {

    public static boolean uniqueOccurrences(int[] arr) {
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < arr.length; i++) {
            map.put(arr[i], map.getOrDefault(arr[i], 0) + 1);
        }

        HashSet<Integer> set = new HashSet<>();
        map.entrySet().forEach(e -> set.add(e.getValue()));

        return map.size() == set.size();
    }

    public static void main(String[] args) {
        System.out.println(uniqueOccurrences(new int[]{1,2,2,1,1,3}));
        System.out.println(uniqueOccurrences(new int[]{-3,0,1,-3,1,1,1,-3,10,0}));
    }
}
